<?php
/*
	提现
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
cfc('core')->checklogin();
$return=array();
$setting=$this->setting;
$setting['balance_per']=$setting['balance_per']?:0;
$credit_types=credit_types(true);
if($_RQ['op']=='get'){
	if($_SESSION['onemerchid']){
		$member=model('jy_merch/member')->getdetail($_SESSION['onemerchid'],$_SESSION['uid']);
	}else{
		$member=pdo_get('core_members',array('id'=>$_SESSION['uid']),array('credit1','credit3','credit4','credit6'));
	}
	$creditfee=array(
		1=>$member['credit1'],
		3=>$member['credit3'],
		4=>$member['credit4'],
		6=>$member['credit6'],
	);
	$member['credit1title']=$credit_types[1];
	$member['credit3title']=$credit_types[3];
	$member['credit4title']=$credit_types[4];
	$member['credit6title']=$credit_types[6];
	$return['item']=$member;
	$return['creditfee']=$creditfee;
	$return['item']['banklist']=array();
	if($this->setting['withdrawtype']){
		$withdrawtype=array();
		$wxapppay_types=array();
		$check=strstr($this->setting['withdrawtype'],'credit');
		if($check){
			$withdrawtype['credit']=$this->pay_types['credit'];
			$wxapppay_types[]=array(
				'key'=>'credit',
				'title'=>$this->pay_types['credit'],
			);
			$pay_type='credit';
		}
		$check=strstr($this->setting['withdrawtype'],'wechat');
		if($check){
			$withdrawtype['wechat']=$this->pay_types['wechat'];
			$wxapppay_types[]=array(
				'key'=>'wechat',
				'title'=>$this->pay_types['wechat'],
			);
			$pay_type=$pay_type?:'wechat';
		}
		$check=strstr($this->setting['withdrawtype'],'alipay');
		if($check){
			$withdrawtype['alipay']=$this->pay_types['alipay'];
			$wxapppay_types[]=array(
				'key'=>'alipay',
				'title'=>$this->pay_types['alipay'],
			);
			$pay_type=$pay_type?:'alipay';
		}
		$check=strstr($this->setting['withdrawtype'],'union');
		if($check){
			$withdrawtype['union']=$this->pay_types['union'];
			$wxapppay_types[]=array(
				'key'=>'union',
				'title'=>$this->pay_types['union'],
			);
			$pay_type=$pay_type?:'union';
		}
		$check=strstr($this->setting['withdrawtype'],'downline');
		if($check){
			$withdrawtype['downline']=$this->pay_types['downline'];
			$wxapppay_types[]=array(
				'key'=>'downline',
				'title'=>$this->pay_types['downline'],
			);
			$pay_type=$pay_type?:'downline';
		}
		$check=strstr($this->setting['withdrawtype'],'jiaoyi');
		if($check){
			$withdrawtype['jiaoyi']=$this->pay_types['jiaoyi'];
			$wxapppay_types[]=array(
				'key'=>'jiaoyi',
				'title'=>$this->pay_types['jiaoyi'],
			);
			$pay_type=$pay_type?:'jiaoyi';
		}
		$return['pay_types']=$withdrawtype;
		$return['wxapppay_types']=$wxapppay_types;
	}else{
		$return['pay_types']=$this->pay_types;
		$pay_type='wechat';
	}
	$return['setting']=$setting;
	$return['post']['fee_type']=$_RQ['type']?:4;
	$return['post']['pay_type']='wechat';
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	$this->model('commission')->create_balance($_SESSION['uid'],$post);
	exi('申请提现成功！','','/myhome/');
}